const { User } = require("../../model/User");

module.exports = async (req, res) => {
    const { message, id } = req.query;
    req.app.locals.currentLink = 'user';
    if (id) {
        // 修改操作
        let user = await User.findOne({_id: id});
        res.render('admin/user-edit', {
            message: message,
            user: user,
            link: '/admin/user-modify?id=' + id,
            button: '修改',
        })

    } else {
        // 添加操作
        res.render('admin/user-edit', {message: message, link: '/admin/user-edit', button: "添加"});
    }
}